package com.insurance.service.impl;


import com.insurance.mapper.DriverEvalMapper;
import com.insurance.pojo.DriverEvaluation;
import com.insurance.service.DriverEvalService;
import com.insurance.utils.ConversionDateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: drc
 * Date: 2020/10/29 16:27
 * Description:
 * Version: V1.0
 */
@Service
public class DriverEvalServiceimpl implements DriverEvalService {
    @Autowired(required = false)
    private DriverEvalMapper driverEvalMapper;
    @Override
    public int updateSensitiveWords(String sensitive_words) {
        return driverEvalMapper.updateSensitiveWords(sensitive_words);
    }

    @Override
    public List<Map> querySensitiveWords() {

        return driverEvalMapper.querySensitiveWords();
    }

    @Override
    public int addDriverEval(DriverEvaluation driverEvaluation) {
        return driverEvalMapper.addDriverEval(driverEvaluation);
    }

    @Override
    public int delDriverEval(Integer id) {
        return driverEvalMapper.delDriverEval(id);
    }

    @Override
    public List<Map> findDriverEval(String string, String string2, String orderTime, String orderTimeEnd, Integer userId) {
        System.out.println("=======================orderTimeEnd"+orderTimeEnd);
        System.out.println("=======================orderTime"+orderTime);
        Date newOrderTime=null;

        if("客户名".equals(string)){
            String userName=string2;
            return driverEvalMapper.findDriverEval1(userName,orderTime,orderTimeEnd);
        } if("司机名".equals(string)){
            String driverName=string2;
            return driverEvalMapper.findDriverEval2(driverName,orderTime,orderTimeEnd);
        } if("客户手机号".equals(string)){
            String userPhone=string2;
            return driverEvalMapper.findDriverEval3(userPhone,orderTime,orderTimeEnd);
        }if("订单号".equals(string)) {
            String orderNumber=string2;
            return driverEvalMapper.findDriverEval4(orderNumber,orderTime,orderTimeEnd, userId);
        }else{
            return driverEvalMapper.findDriverEval4(string2,orderTime,orderTimeEnd,userId);
        }
    }
}
